package com.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

//@RestController
@Controller
public class MonsterController {
    //等价写法
    //@RequestMapping(value = "/monster",method = RequestMethod.GET)
    @GetMapping("/monster")
    public String getMonster(){
        return "Get-查询妖怪";
    }
    //等价写法
    //@RequestMapping(value = "/monster",method = RequestMethod.POST)
    @PostMapping("/monster")
    public String saveMonster(){
        return "Post-添加妖怪";
    }
    //等价写法
    //@RequestMapping(value = "/monster",method = RequestMethod.PUT)
    @PutMapping("/monster")
    public String putMonster(){
        return "Put-修改妖怪";
    }
    //等价写法
    //@RequestMapping(value = "/monster",method = RequestMethod.DELETE)
    @DeleteMapping("/monster")
    public String delMonster(){
        return "Del-删除妖怪";
    }
    @RequestMapping("/go")
    public String go(){
        return "hello";
        //！！顺序：1.先看controller中有没有/hello【如果没有配置视图解析器】
        //2.如果配置了视图解析器，就会按照视图解析器的方式查找
    }
}
